<?php
include_once 'clsEssentials.php';
class clsFormLayouts
{
	function frmPopulateChangePassword()
	{
		?>
				<form id="frmChangePassword" name="frmChangePassword" method="post" action="#">
				<table cellpadding="2px" cellspacing="1px" bgcolor="#F4F5F7" width="100%" style="height:360px;" class="tableBorder">
			    <tr>
			        <td colspan="2" bgcolor="#0066FF" valign="bottom">
			        	<label style="float: right;vertical-align: text-bottom;color:#FFF">Both fields are mandatory </label>
			        </td>
			    </tr>
			     <tr>
			        <td colspan="2">
			        <input type="hidden" id="hdnUserName" name="hdnUserName" value="<?php echo $userName; ?>" />
			        </td>
			        
			    </tr>
			    
			    <tr>
			        <td class="label" align="right" width="40%">New Password:</td>
			        <td align="left" width="60%"><input type="password" id="txtNewPass" name="txtNewPass" style="width: 160px;" maxlength="200"/></td>
			    </tr>
			    <tr>
			        <td class="label" align="right">Confirm Password:</td>
			        <td align="left"><input type="password" name="txtConfirmPassword" id="txtConfirmPassword" maxlength="50" style="width: 160px;" /></td>
			    </tr>
			    
			    <tr>
			    	<td colspan="2">&nbsp;</td>
			    </tr>
			    <tr>
			        <td align="center" colspan="2">
				        <input class="normalBtn" type="button" value="Update >>" id="btnLogin" name="btnLogin" onclick="return doCheckPassword();" />
				        <input class="normalBtn" type="reset" value="Reset >>" id="btnReset" name="btnReset" />
			        </td>
			    </tr>                  
			    
			               
			</table>			
			</form>
		<?php 
	}
	
	
	
	function frmChangeCategories()
	{
		?>
						<form id="frmChangeCategory" name="frmChangeCategory" method="post" action="#">
						<table cellpadding="2px" cellspacing="1px" bgcolor="#89B3FF" style="color: navy;" width="100%" class="tableBorder">
					    <tr height="30">
					        <td colspan="2" bgcolor="#797B7B" valign="bottom">
					        	<label style="float: right;vertical-align: text-bottom;color:#FFF">* field(s) are mandatory </label>
					        </td>
					    </tr>
					    
					    <tr height="40">
					    	<td colspan="2" align="right">
					    		<input class="normalBtn" style="cursor: pointer;" type="button" value="Show All Categories" id="btnshowAllCategories" name="btnshowAllCategories" onclick="return divshow('showAllCategories');" />
					    		&nbsp;<input style="cursor: pointer;" class="normalBtn" type="button" value="Add Categories" id="btnAddCategories" name="btnAddCategories" onclick="return divshow('AddCategories');" />
					    	</td>
					    	
					    </tr>
					    
					    <tr height="30" >
					    	<td colspan="2">
					    	<div id="showAllCategories" style="display: none;">
					    	<fieldset>
					    		<legend>All Category</legend>
					    	<div style="float: right;margin-top:-8px">
					    		<img style="cursor: pointer;" src="images/close_button-icon.gif" width="20" height="20" border="0"  onclick="javascript:document.getElementById('showAllCategories').style.display='none'" title="Close" />
					    	</div>
					    	<table width="100%" cellpadding="0" cellspacing="0">
					    	<thead>
					    		<tr>
					    			<td>Category Name</td>
					    			<td>Actions</td>
					    		</tr>
					    	</thead>
					    	<tbody>
					    	<?php 
					    	
					    	$arrCategory = array();
					    	$objClsEssential = new clsEssentials();
					    	$arrCategory  =$objClsEssential->getAllCategories();
					    	
					    	foreach($arrCategory as $cat)
					    	{
					    		?>
				    		<tr>
					    		<td><?php echo $cat["category_name"] ?></td>
					    		<td>
					    			<a href="javascript:void(0);" onclick="showEditCategoryDiv('<?php echo $cat["category_name"] ?>','<?php echo $cat["id"]; ?>');">Edit</a>
					    			<a href="javascript:void(0);" onclick="categoryAction('deletecategory','<?php echo $cat["id"]; ?>')">Delete</a>
					    		</td>	
				        	</tr>
					    		<?php 
					    	}
					    	?>
			
					        </tbody>
					        </table>
					        </fieldset>
					        </div>
					        </td>
					    </tr> 
					    
					    <tr height="30">
					    	<td colspan="2">
					    	<!-- Add Category -->
					    	<div id="AddCategories" name="AddCategories" style="display: none;">
					    	<fieldset>
					    		<legend>Create Category</legend>
				    		<div style="float: right;margin-top:-8px">
				    			<img style="cursor: pointer;" src="images/close_button-icon.gif" width="20" height="20" border="0"  onclick="javascript:document.getElementById('AddCategories').style.display='none'" title="Close" />
				    		</div>
					    	<table>
					    	<tr>	
					        <td class="label" align="right" width="18%">Category Name:</td>
					        <td align="left" width="70%">
					        	<input type="text" id="txtCategoryName" name="txtCategoryName" style="width: 220px;" maxlength="200"/>&nbsp;
					        	<input class="normalBtn" type="button" value="Create >>" id="btnLogin" name="btnLogin" onclick="doCheckCategoryName();" />
					        </td>
					        </tr>
					        </table>
					        </fieldset>
					        </div>
					        <!-- Add Category Ends -->
					        <!-- Edit Category Starts -->
					        <div id="EditCategories" name="EditCategories" style="display: none;">
					    	<fieldset>
					    		<legend>Edit Category</legend>
				    		<div style="float: right;margin-top:-8px">
				    			<img style="cursor: pointer;" src="images/close_button-icon.gif" width="20" height="20" border="0"  onclick="javascript:document.getElementById('EditCategories').style.display='none'" title="Close" />
				    		</div>
					    	<table>
					    	<tr>	
					        <td class="label" align="right" width="18%">Category Name:</td>
					        <td align="left" width="70%">
					        	<input type="text" id="txtEditCategoryName" name="txtEditCategoryName" style="width: 220px;" maxlength="200"/>&nbsp;
					        	<input type="hidden" id="hdnEditCategoryId" name="hdnEditCategoryId" value="" />
					        	<input class="normalBtn" type="button" value="Update >>" id="btnLogin" name="btnLogin" onclick="doUpdateCategoryName();" />
					        </td>
					        </tr>
					        </table>
					        </fieldset>
					        </div>
					        <!-- Edit category Ends -->
					        </td>
					    </tr>                
					    <tr>
					    	<td>&nbsp;</td>
					    </tr>
					               
					</table>			
					</form>
				<?php 
	}
	
	
	/*
	 * The Following function adds subcategory and map that with a category.
	 */
	function frmChangeSubCategories()
	{
		?>
							<form id="frmChangeSubCategory" name="frmChangeSubCategory" method="post" action="#">
							<table cellpadding="2px" cellspacing="1px" bgcolor="#89B3FF" style="color: navy;" width="100%" class="tableBorder">
						    <tr height="30">
						        <td colspan="2" bgcolor="#797B7B" valign="bottom">
						        	<label style="float: right;vertical-align: text-bottom;color:#FFF">* field(s) are mandatory </label>
						        </td>
						    </tr>
						    
						    <tr height="40">
						    	<td colspan="2" align="right">
						    		<input class="normalBtn" style="cursor: pointer;" type="button" value="Show All Subcategories" id="btnshowAllSubCategories" name="btnshowAllSubCategories" onClick="return divshow('showAllSubCategories');" />
						    		&nbsp;<input style="cursor: pointer;" class="normalBtn" type="button" value="Add Subcategories" id="btnAddSubCategories" name="btnAddSubCategories" onClick="return divshow('AddSubCategories');" />
						    	</td>
						    	
						    </tr>
						    
						    <tr height="30" >
						    	<td colspan="2">
						    	<div id="showAllSubCategories">
						    	<fieldset>
						    		<legend>All SubCategory</legend>
						    	<div style="float: right;margin-top:-8px">
						    		<img style="cursor: pointer;" src="images/close_button-icon.gif" width="20" height="20" border="0"  onclick="javascript:document.getElementById('showAllSubCategories').style.display='none'" title="Close" />
						    	</div>
						    	<table width="100%" cellpadding="0" cellspacing="0">
						    	<thead>
						    		<tr>
						    			<td>SubCategory Name</td>
						    			<td>Cateogry Name</td>
						    			<td>Actions</td>
						    		</tr>
						    	</thead>
						    	<tbody>
						    	<?php 
						    	
						    	$arrSubCategory = array();
						    	$objClsEssential = new clsEssentials();
						    	$arrSubCategory  =$objClsEssential->getAllSubCategories();
						    	
						    	$arrCategory = array();
						    	$arrCategory  =$objClsEssential->getAllCategories();
						    	
						    	foreach($arrSubCategory as $cat)
						    	{
						    		?>
					    		<tr>
						    		<td><?php echo $cat["subcategory_name"] ?></td>
						    		<td><?php echo $cat["category_name"] ?></td>
						    		<td>
						    			<a href="javascript:void(0);" onclick="subcategoryAction('edit','<?php echo $cat["id"]; ?>')">Edit</a>
						    			<a href="javascript:void(0);" onclick="subcategoryAction('delete','<?php echo $cat["id"]; ?>')">Delete</a>
						    		</td>	
					        	</tr>
						    		<?php 
						    	}
						    	?>
				
						        </tbody>
						        </table>
						        </fieldset>
						        </div>
						        </td>
						    </tr> 
						    
						    <tr height="30">
						    	<td colspan="2">
						    	<div id="AddSubCategories" name="AddSubCategories" style="display: none;">
						    	<fieldset>
						    		<legend>Create Subcategory</legend>
					    		<div style="float: right;margin-top:-8px">
					    			<img style="cursor: pointer;" src="images/close_button-icon.gif" width="20" height="20" border="0"  onclick="javascript:document.getElementById('AddSubCategories').style.display='none'" title="Close" />
					    		</div>
						    	<table>
						    	<tr>	
						        <td class="label" align="right" width="40%">Subcategory Name:</td>
						        <td align="left" width="40%">
						        	<input type="text" id="txtSubCategoryName" name="txtSubCategoryName" style="width: 220px;" maxlength="200"/>&nbsp;
						        </td>
						        </tr>
						        <tr>
						        <td align="right" >Category Name:</td>
						        <td>
						        	<select id="ddlcategoryName" name="ddlcategoryName" style="width: 160px;">
						        		<option value="-select-">--Select--</option>
						        		<?php 
						        		foreach($arrCategory as $cat)
						        		{
						        		?>
						        			<option value="<?php echo $cat["id"]; ?>"><?php echo $cat["category_name"] ?></option>
						        		<?php 
						    			}
						    			?>
						        	</select>
						        </td>
						        </tr>
						        <tr>
						        <td>&nbsp;</td>
						        <td align="left">
						        	<input class="normalBtn" type="button" value="Create >>" id="btnLogin" name="btnLogin" onclick="doCheckSubCategoryName();" />
						        </td>
						        </tr>
						        </table>
						        </fieldset>
						        </div>
						        </td>
						    </tr>                
						    <tr>
						    	<td>&nbsp;</td>
						    </tr>
						               
						</table>			
						</form>
					<?php 
		}
		
		
		/**
		 * Funtion to Upload Videos
		 */
		
	function frmUploadVideos()
		{
			?>
				<form id="frmUploadVideo" enctype="multipart/form-data" action="upload-video.php" method="POST">
				
				<table cellpadding="2px" cellspacing="1px" border="0" bgcolor="#89B3FF" style="color: navy;" width="100%" class="tableBorder">
					    <tr align="left" height="30">
					        <td colspan="2" bgcolor="#797B7B" valign="bottom">
					        	<label style="float: right;vertical-align: text-bottom;color:#FFF">* field(s) are mandatory </label>
					        </td>
					    </tr>
					    <tr align="left" height="30">
					        <td align="right">
					        	<label>Please choose a video to upload:</label> 
					        </td>
					        <td>
					        	<input size="40" id="uploaded" name="uploaded" type="file" /><br />
					        </td>
					    </tr>
					    <tr align="left" height="30">
					        <td align="right">
					        	<label>Please choose a video thumbnail to upload:</label> 
					        </td>
					        <td>
					        	<input size="40" id="uploadedThumb" name="uploadedThumb" type="file" /><br />
					        </td>
					    </tr>
					    <?php 
					   	$objClsEssential = new clsEssentials();										    	
						$arrCategory = array();
						
						$arrCategory  =$objClsEssential->getAllCategories(); 
						$arrSubCategory  =$objClsEssential->getAllSubCategories();
						?>
					   <tr>
						        <td align="right" >Category Name:</td>
						        <td>
						        	<div name="ddlCategorySelect" id="ddlCategorySelect">
						        	<select id="ddlcategoryName" name="ddlcategoryName" style="width: 160px;" onchange="populateSubcategory">
						        		<option value="-select-">--Select--</option>
						        		<?php 
						        		foreach($arrCategory as $cat)
						        		{
						        		?>
						        			<option value="<?php echo $cat["id"]; ?>"><?php echo $cat["category_name"] ?></option>
						        		<?php 
						    			}
						    			?>
						        	</select>
						        	</div>
						        </td>
						</tr>
						<tr>
							<td align="right">
								<label>SubCategory Name:</label>
							</td>
							<td>
								<div name="ddlSubCategorySelect" id="ddlSubCategorySelect">
						        		<select id="ddlSubcategoryName" name="ddlSubcategoryName" style="width: 160px;">
						        		<option value="-select-">--Select--</option>
						        		<?php 
						        		foreach($arrSubCategory as $cat)
						        		{
						        		?>
						        			<option value="<?php echo $cat["id"]; ?>"><?php echo $cat["subcategory_name"] ?></option>
						        		<?php 
						    			}
						    			?>
						        	</select>
						        	</div>
							</td>
						</tr>
					 	<tr>
					        <td align="right" >
					        	<label>Please Enter Video Title:</label>
					        </td>
					        <td>
					        	<input size="40" id="txt_vid_title" name="txt_vid_title" type="text" />
					        </td>
					    </tr>
					    
					    <tr>
					        <td align="right">
					        	<label>Please Enter Video Description:</label>
					        </td>
					        <td>
					        	<textarea rows="10" cols="40" id="txtarea_vid_desc" name="txtarea_vid_desc" ></textarea>
					        </td>
					    </tr>
					    
					    <tr>
					    	<td align="right"><label>Enter Keywords for search:</label></td>
					    	<td>
					    		<textarea rows="5" cols="40" id="txtarea_vid_keywords" name="txtarea_vid_keywords" ></textarea>
					    	</td>
					    </tr>
					    
					    <tr>
					    	<td align="right"> <label>Video View Mode:</label> </td>
					    	<td>
					    		<input type="radio" name="video_view_mode" id="video_view_mode_pub" value="public">Public
					    		<input type="radio" name="video_view_mode" value="private" id="video_view_mode_pri">Private
					    	</td>
					    </tr>
					
					
					<tr>
					        <td  bgcolor="#797B7B" valign="bottom">
					        	<input class="normalBtn" type="submit" value="Upload" id="btnUpload" name="btnUpload"  />
					        	<input class="normalBtn" type="reset" value="Reset" id="btnReset" name="btnReset"  />
					        </td>
					         <td bgcolor="#797B7B" valign="bottom">
					        	<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
					        </td>
					 </tr>
					    
					    
				</table>	    
				
						
				</form> 
				<?php 
	}
		
	
	
	function frmUserDetails()
	{
		?>
		<form id="frmUserDetails" name="frmUserDetails" method="post" action="#">
			<table cellpadding="2px" cellspacing="1px" bgcolor="#89B3FF" style="color: navy;" width="100%" class="tableBorder">
		    <tr height="30">
		        <td colspan="2" bgcolor="#797B7B" valign="bottom">
		        	<label style="float: right;vertical-align: text-bottom;color:#FFF">User Details</label>
		        </td>
			</tr>
			<tr>
		    	<td colspan="2">
			    	<fieldset>
			    		<legend>All Users</legend>
			    	
			    	<table width="100%" cellpadding="0" cellspacing="0">
			    	<thead>
			    		<tr>
			    			<td>Sl No</td>
			    			<td>User Email</td>
			    			<td>User Type</td>
			    			<td>Actions</td>
			    		</tr>
			    	</thead>
			    	<tbody>
			    		<?php 
					   	$objClsEssential = new clsEssentials();										    	
						$arrUsers = array();
						$arrUsers  =$objClsEssential->getAllUsers(); 
					  	$counter=1;
					    foreach($arrUsers as $cat)
				    	{
			    		?>
				    		<tr>
				    			<td><?php echo $counter; ?></td>
					    		<td><?php echo $cat["txt_user_name"] ?></td>
					    		<td><?php echo $cat["txt_user_name"] ?></td>
					    		<td>
					    			<a href="javascript:void(0);" onclick="upgradeUser('<?php echo $cat["id"]; ?>')">Upgrade</a>
					    			<?php if($cat['yn_is_active']=="Y") { ?>
					    			<a href="javascript:void(0);" onclick="Activate_Deactivate_User('deact', '<?php echo $cat["id"]; ?>')">Deactivate</a>
					    			<?php } 
					    			else 
					    			{
					    			?>
					    			<a href="javascript:void(0);" onclick="Activate_Deactivate_User('act', '<?php echo $cat["id"]; ?>')">Activate</a>
					    			<?php }?>
					    		</td>	
				        	</tr>
			    		<?php 
			    			$counter++;
				    	}
				    	?>
			    	</tbody>
			    	</table>
			    	</fieldset>
			    </td>
			   </tr>
			   </table>
			</form>
		<?php 
	}
	
	function frmVideoAllVideos()
	{
		?>
			<form id="frmVideoAllVideos" name="frmVideoAllVideos" method="post" action="#">
				<table cellpadding="2px" cellspacing="1px" bgcolor="#89B3FF" style="color: navy;" width="100%" class="tableBorder">
			    <tr height="30">
			        <td colspan="2" bgcolor="#797B7B" valign="bottom">
			        	<label style="float: right;vertical-align: text-bottom;color:#FFF">View All Videos</label>
			        </td>
				</tr>
				<!-- LOOP TR -->
				<?php 
					   	$objClsEssential = new clsEssentials();										    	
						$arrVideoDetails = array();
						$arrVideoDetails  =$objClsEssential->getAllVideoDetails(); 
					  	$counter=1;
					    foreach($arrVideoDetails as $cat)
				    	{
				    			$videoId = $cat["int_video_id"];
				    			$videoTitle = $cat["txt_video_title"];
				    			$videoThumbPath = "".$cat["txt_thumb_video_path"];
				    			$videoPath = "".$cat["txt_video_path"];
				    			$videoUploaderUserId = $cat['int_user_id'];
				    			$videoUploaderName = $cat["txt_first_name"]."&nbsp;".$cat["txt_last_name"];
				    			$videoDescription = $cat["txt_video_desc"];
				    			if(strlen($videoDescription)>150)
				    				$videoDescription = substr($videoDescription,0,150);
				    			if($counter%2==1)
				    				$style=1;
				    			else
				    				$style=2;
			    		?>
				<tr>
					<table cellpadding="5" cellspacing="3" class="tblVideos<?php echo $style; ?>">
						<tr>
							<td>
								<img src="<?php print $videoThumbPath; ?>" class="imgVideoPlay" width="209" height="132" />	
							</td>
							<td>
								<table style="width: 508px">
									<tr><td colspan="2"><span class="video-header"><?php echo $videoTitle; ?></span></td></tr>
									<tr><td colspan="2">by <span><?php echo $videoUploaderName; ?></span>&nbsp;</td></tr>
									<tr><td colspan="2">
									<span class="video-desc"><?php echo $videoDescription; ?>...</span> 
									</td></tr>
									<tr>
										<td>
											<input type="button" value="Play Video" id="btnPlay" name="btnPlay" onclick="playVideo('<?php echo $videoId;?>')" />
										</td>
										<td align="right">
											<span class="video-likes">&nbsp;</span>
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
				</tr>
				<?php 
					$counter++;
				    	}
				?>
				<!-- LOOP TR ENDS -->
				</table>
				</form>
			<?php 
		}
	
}